package com.zheng.umbrella.rpc.service.impl;

import com.zheng.umbrella.dao.mapper.UmbrellaHardwareBatchMapper;
import com.zheng.umbrella.dao.mapper.UmbrellaHardwareMachineMapper;
import com.zheng.umbrella.dao.mapper.UmbrellaRuleRentMapper;
import com.zheng.umbrella.dao.model.*;
import com.zheng.umbrella.dao.use.model.UmbrellaBatchUpdate;
import com.zheng.umbrella.rpc.api.UmbrellaHardwareApiService;
import com.zheng.umbrella.rpc.mapper.UmbrellaHardwareApiMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Administrator on 2018/9/23.
 */
@Service
@Transactional
public class UmbrellaHardwareApiServiceImpl implements UmbrellaHardwareApiService {
    @Autowired
    private UmbrellaHardwareMachineMapper umbrellaHardwareMachineMapper;
    @Autowired
    private UmbrellaHardwareBatchMapper umbrellaHardwareBatchMapper;
    @Autowired
    private UmbrellaRuleRentMapper umbrellaRuleRentMapper;

    @Autowired
    private UmbrellaHardwareApiMapper umbrellaHardwareApiMapper;

    /**
     * 获取批次
     * @param example
     * @return
     */
    public List<UmbrellaHardwareBatch> selectBatchByExample(UmbrellaHardwareBatchExample example){
        return umbrellaHardwareBatchMapper.selectByExample(example);
    }
    /**
     * 获取伞机
     * @param example
     * @return
     */
    public List<UmbrellaHardwareMachine> selectMachineByExample(UmbrellaHardwareMachineExample example){
        return umbrellaHardwareMachineMapper.selectByExample(example);
    }

    /**
     * 获取租金规则
     * @param example
     * @return
     */
    @Override
    public List<UmbrellaRuleRent> selectRuleRentByExample(UmbrellaRuleRentExample example) {
        return umbrellaRuleRentMapper.selectByExample(example);
    }

    /**
     * 批量导入雨伞
     * @param list
     * @return
     */
    @Override
    public int insertBatch(List<UmbrellaHardwareUmbrella> list) {
        return umbrellaHardwareApiMapper.insertBatch(list);
    }
    /**
     * 批量更新雨伞id
     * @param list
     * @return
     */
    @Override
    public int updateBatch(List<UmbrellaBatchUpdate> list) {
        return umbrellaHardwareApiMapper.updateBatch(list);
    }

}
